package com.zw.pdm.module.basic.service;

import com.zw.pdm.entity.basic.Verify;
import com.zw.pdm.module.basic.mapper.VerifyMapper;
import com.zw.pdm.module.basic.repository.VerifyRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.zw.pdm.util.BeanUtil.copy;


/**
 * @Description:
 *
 * @Author: China.sgl
 * @Date: 2019/12/6 08:42
 */
@Service
@SuppressWarnings("all")
public class VerifyService {

    @Autowired
    private VerifyMapper verifyMapper;
    @Autowired
    private VerifyRepository verifyRepository;

    /** 按条件查询 */
    public List<Verify> findByCondition(Verify verify) {
        return verifyMapper.findByCondition(verify);
    }

    /** 保存 */
    public Verify saveVerify(Verify verify) {
        return verifyRepository.save(verify);
    }

    /** 修改 */
    public Verify updateVerify(Verify verify) {
        Verify target = verifyRepository.getOne(verify.getId());
        copy(verify, target);
        return verifyRepository.saveAndFlush(target);
    }


}
